-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix panic when pending pipelinerun is failed #4298
Conversation
PipelineRuns that are created with status PipelineRunPending can be placed into a failed state before their execution begins. For example: a third-party controller may be watching for pending PipelineRuns to perform some checks on them prior to execution beginning. If those checks fail the controller might choose to set the PipelineRun status to failed with a relevant error message indicating which check failed and why. Prior to this commit when a pending PR failed our metrics code could panic because the PR's StartTime is nil. This commit adds a guard to the metrics code to ensure that StartTime is not nil before computing the PR's duration. If it is nil then we assume the duration is 0. A unit test confirming this behaviour has been added as well.
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-alpha-integration-tests |
1 similar comment
/test pull-tekton-pipeline-alpha-integration-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @sbwsg for this fix 👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pritidesai The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-tekton-pipeline-alpha-integration-tests |
/test pull-tekton-pipeline-alpha-integration-tests |
ooo yikes nice fix! /lgtm (side note, apparently we only have 2 test flake issues - im wondering if this PR is a fluke or if we're not recording the flakes that are occurring 🤔 ) |
I have seen multiple flakes in the past few days, but haven't recorded any 😞 including, #4281 (comment), #4286 (comment), and many more |
@pritidesai i wonder if it would be helpful if we made a template for creating flake bugs specifically to make it easier to record them 🤔 |
sorry @bobcatfish for delayed response, just saw this. Definitely, I think it will be useful to create such template. I am not sure if its possible but when prow reports integration test failure, if we can attach such template so that the PR author can create a new issue. |
Changes
Fixes #4297
PipelineRuns that are created with status PipelineRunPending
can be placed into a failed state before their execution begins.
For example: a third-party controller may be watching for pending
PipelineRuns to perform some checks on them prior to execution
beginning. If those checks fail the controller might choose to
set the PipelineRun status to failed with a relevant error message
indicating which check failed and why.
Prior to this commit when a pending PR failed our metrics code
could panic because the PR's StartTime is nil.
This commit adds a guard to the metrics code to ensure that StartTime
is not nil before computing the PR's duration. If it is nil then
we assume the duration is 0. A unit test confirming this behaviour
has been added as well.
/kind bug
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes